package com.techshinogongjian.fp.util;

import com.techshinogongjian.fingerprint.FPConfig;

/**
 * API参数配置项目
 * 
 * @author Administrator
 *
 */
public class FpConfig {
	
	/* ===================算法版本======================= */
	public static final int FEATURE_TYPE_BASE64 = 0; // BIN with base64
	public static final int FEATURE_TYPE_0x30 = 1; // BIN with 0x30
	public static final int FEATURE_TYPE_BIN = 2; // BIN
	public static final int FEATURE_TYPE_ISO = 3; // ISO/交行
	public static final int FEATURE_TYPE_OLDBASE64 = 4; // old teso base64
	public static final int FEATURE_TYPE_GA = 5; // GA
	public static final int FEATURE_TYPE_V500_GA = 6; // GA

	// Inernational for V500 algorithm
	public static final int FEATURE_INTERNATIONAL_PROPRIETARY_FORMAT = 7;
	public static final int FEATURE_INTERNATIONAL_ISO_19794_2_2005 = 8;
	public static final int FEATURE_INTERNATIONAL_INCITS_378_2004 = 9;
	public static final int FEATURE_INTERNATIONAL_INCITS_378_2009 = 10;
	public static final int FEATURE_INTERNATIONAL_ISO_19794_2_2011 = 11;

	/* ===================配置项======================= */
	public static final int T_VERSION = 0; // 00.库的版本信息＝0x01000008
	public static final int T_SUMREGS = 1; // 01.寄存器的总数＝??
	public static final int T_USEPORT = 2; // 02.通讯所用端口＝0
	public static final int T_UPROTOC = 3; // 03.USB_协议类型＝UXY_SIMPLE
	public static final int T_CPROTOC = 4; // 04.COM_协议类型＝CXY_LASERX
	public static final int T_DEVREGS = 5; // 05.用设备配置值＝FALSE
	public static final int T_REGTMOT = 6; // 06.注册ms超时量＝30000
	public static final int T_VERTMOT = 7; // 07.认证ms超时量＝18000
	public static final int T_RMUTFMT = 8; // 08.返回特征编码＝FMT_B64
	public static final int T_RIMGFMT = 9; // 09.返回图像格式＝BMP_B64
	public static final int T_REGTEST = 10; // 10.注册补测一次＝TRUE
	public static final int T_NOCLOSE = 11; // 11.连接后不关闭＝FALSE
	public static final int T_SNAPFRQ = 12; // 12.抓拍ms间隔量＝1
	public static final int T_LEAVEUP = 13; // 13.抬起ms检测量＝2000
	public static final int T_SUCCDLY = 14; // 14.成功延ms关闭＝1
	public static final int T_FAILDLY = 15; // 15.失败延ms关闭＝800
	public static final int T_SHOWREG = 16; // 16.弹出注册窗体＝TRUE
	public static final int T_SHOWVER = 17; // 17.弹出认证窗体＝FALSE
	public static final int T_COMBAUD = 18; // 18.当前的波特率＝3
	public static final int T_COMSPED = 19; // 19.是否自动提速＝14
	public static final int T_COMSPLT = 20; // 20.传输用拆分吗＝FALSE
	public static final int T_COMIMGS = 21; // 21.取四分二值图＝2
	public static final int T_CPREFIX = 22; // 22.串口BP前缀串＝NULL
	public static final int T_CSUFFIX = 23; // 23.串口BP后缀串＝NULL
	public static final int T_CALLBCK = 24; // 24.回调函数地址＝NULL
	public static final int T_CALLPAR = 25; // 25.回调首个参数＝0
	public static final int T_STBWAIT = 26; // 26.稳定ms等待量＝300
	public static final int T_SYNSAMT = 27; // 27.合成相关阈值＝10
	public static final int T_VARIANC = 28; // 28.图像最小方差＝150
	public static final int T_GODAREA = 29; // 29.最小有效面积＝22
	public static final int T_RMVBLCK = 30; // 30.最大去黑比率＝35
	public static final int T_TPLMINS = 31; // 31.预注册最少点＝8
	public static final int T_FPCPREP = 32; // 32.作FPC_预处理＝1
	public static final int T_CHKSAME = 33; // 33.完全同不匹配＝1
	public static final int T_SAFLVL1 = 34; // 34.比对安全一级＝30
	public static final int T_SAFLVL2 = 35; // 35.比对安全二级＝35
	public static final int T_SAFLVL3 = 36; // 36.比对安全三级＝40
	public static final int T_SAFLVL4 = 37; // 37.比对安全四级＝45
	public static final int T_SAFLVL5 = 38; // 38.比对安全五级＝50
	public static final int T_LSNTMOT = 39; // 39.监听毫秒超时＝0

	public static final int TSUM_REGS = 40; // 01.实际寄存器的总数
	public static final int TMAX_REGS = 80; // 80.寄存器总数量
	public static final int T_LINKDEV = 80; // 80.设备连接指令＝0断开1连接

	public FpConfig() {
		// TODO Auto-generated constructor stub
	}

	// ////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// 大容量存储,配置参数
	//
	//
	//
	// ///////////////////////////////////////////////////////////////////////////////////////////

	public static final int IMAGE_SMALL = 0;
	public static final int IMAGE_BIG = 1;

	private static int sImageType = IMAGE_SMALL;

	public static void setImageType(int imageType) {
		if (imageType == IMAGE_BIG) {
			sImageType = IMAGE_BIG;
		} else if (imageType == IMAGE_SMALL) {
			sImageType = IMAGE_SMALL;
		} else {
			sImageType = IMAGE_SMALL;
		}
	}

	public static int getImageType() {
		return sImageType;
	}

	// ////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// 二代证核验模块,配置参数
	//
	//
	//
	// ///////////////////////////////////////////////////////////////////////////////////////////
	public final static int BAUD_0 = 0; // 波特率2400
	public final static int BAUD_1 = 1; // 波特率9600
	public final static int BAUD_2 = 2; // 波特率19200
	public final static int BAUD_3 = 3; // 波特率38400
	public final static int BAUD_4 = 4; // 波特率57600
	public final static int BAUD_5 = 5; // 波特率115200

	public final static int LEVEL_0 = 0; // 1%
	public final static int LEVEL_1 = 1; // 0.1%
	public final static int LEVEL_2 = 2; // 0.01%
	public final static int LEVEL_3 = 3; // 0.001%
	public final static int LEVEL_4 = 4; // 0.0001%

	private static int sBaud = BAUD_5;
	private static int sLevel = LEVEL_0;
	private static boolean isBigPic = false;
	private static boolean isEnrollDownload = false;
	private static boolean isVerifyDownload = false;

	public static boolean isBigPic() {
		return isBigPic;
	}

	public static void setBigPic(boolean isBigPic) {
		FpConfig.isBigPic = isBigPic;
	}

	public static void setEnrollDownload(boolean isEnrollDownload) {
		FpConfig.isEnrollDownload = isEnrollDownload;
	}

	public static boolean isEnrollDownload() {
		return isEnrollDownload;
	}

	public static boolean isVerifyDownload() {
		return isVerifyDownload;
	}

	public static void setVerifyDownload(boolean isVerifyDownload) {
		FpConfig.isVerifyDownload = isVerifyDownload;
	}

	public static void setBaud(int baud) {
		sBaud = baud;
	}

	public static int getBaud() {
		return sBaud;
	}

	public static void setLevel(int level) {
		sLevel = level;
	}

	public static int getLevel() {
		return sLevel;
	}

	public static int getBaud(int state) {
		int baud;
		switch (state) {
		case BAUD_0:
			baud = 2400;
			break;
		case BAUD_1:
			baud = 9600;
			break;
		case BAUD_2:
			baud = 19200;
			break;
		case BAUD_3:
			baud = 38400;
			break;
		case BAUD_4:
			baud = 57600;
			break;
		case BAUD_5:
			baud = 115200;
			break;
		default:
			baud = 115200;
			break;
		}
		return baud;
	}

	public static float getSecurityLevel(int state) {
		float level;
		switch (state) {
		case LEVEL_0:
			level = 0.01f;
			break;
		case LEVEL_1:
			level = 0.001f;
			break;
		case LEVEL_2:
			level = 0.0001f;
			break;
		case LEVEL_3:
			level = 0.00001f;
			break;
		case LEVEL_4:
			level = 0.000001f;
			break;
		default:
			level = 0.01f;
			break;
		}
		return level;
	}

	// ////////////////////////////////////////////////////////////////////////////////////////////
	//
	//
	//
	// 指纹算法配置参数
	//
	//
	//
	// ///////////////////////////////////////////////////////////////////////////////////////////

	public static int getFeatureType() {
		return FPConfig.getFeatureType();
	}
	public static void setFeatureType(int featureType) {
		FPConfig.setFeatureType(featureType);
	}
	
	
}
